package com.abc.controller;

import com.abc.entity.User;
import com.abc.entity.Xuesheng;
import com.abc.service.XueshengService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class XueshengController {
    @Autowired
    private XueshengService xueshengService;
    @RequestMapping(value = "/addXuesheng")
    @ResponseBody
    public String addXuesheng(Xuesheng xuesheng){
        return xueshengService.addXuesheng(xuesheng);
    }
    @RequestMapping(value = "/findAllXuesheng")
    @ResponseBody
    public List<Xuesheng> findAllXuesheng(){
        return xueshengService.findAllXuesheng();
    }
    @RequestMapping(value = "/findXinxi")
    @ResponseBody
    public User findXinxi(HttpServletRequest request){
        return (User)request.getSession().getAttribute("user");
    }



}
